package com.custom.customtickview;

import androidx.appcompat.app.AppCompatActivity;

import android.annotation.SuppressLint;
import android.os.Build;
import android.os.Bundle;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.widget.TextView;

public class MainActivity extends AppCompatActivity {

    private CustomTickView customTickView;
    private TextView tv_show;

    @SuppressLint("ObsoleteSdkInt")
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
            Window window = getWindow();
            window.setFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS,
                    WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
            getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION);
            getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
        }
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        tv_show = findViewById(R.id.tv_show);
        customTickView = findViewById(R.id.customTickView);
        customTickView.setUpEvent();//运行动画
        customTickView.setOnCheckedChangeListener(new CustomTickView.OnCheckedChangeListener() {
            @Override
            public void onCheckedChanged(CustomTickView tickView, boolean isCheckd) {
                if(!isCheckd){
                    tv_show.setText("未完成签到");
                }else{
                    tv_show.setText("已签到");
                }

            }
        });

    }
}
